<?php

class Ext_Attachment_Shopping_Show
{
    public $shoppingId;
    public $attachmentShoppingId;
    public $shopping;
    public $name;
    public $title;
    public $description;
    public $descriptionHtmlOn;
    
    public function __construct($attachmentShoppingId)
    {
        $this->shopping = new Ext_Shopping_Show();
        $this->_build($attachmentShoppingId);
    }
    
    private function _build($attachmentShoppingId)
    {
        $this->attachmentShoppingId = $attachmentShoppingId;

        $attachmentShopping = App_Model_DbTable_Attachment_Shopping::getInstance()->getRowById($attachmentShoppingId);

        if(isset($attachmentShopping['shoppingId'])){
            $this->shoppingId = $attachmentShopping['shoppingId'];
            $this->shopping->build($this->shoppingId);
        }
        
        if(isset($attachmentShopping['name'])){
            $this->name  = $attachmentShopping['name'];
        }

        if($this->name != ''){
            $this->title = $this->name;
        }
        if($this->shopping->price != ''){
            $this->title .= ' [¥'.$this->shopping->price.']';
        }
        
        if(isset($attachmentShopping['description'])){
            $this->description       = $attachmentShopping['description'];
            $this->descriptionHtmlOn = $attachmentShopping['descriptionHtmlOn'];
        }
    }
}


